
{% from "/layout/confirm_box.html" import confirm_box,confirm_call with context %}
{% if  node.has_user %}
    {% set modal_id ="Modal"+ node.nid| string  %}
    {% set modal_endpoint ="/flow/create_node_config/"+node.nid| string  %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <span style="font-weight: bold">人员配置信息</span>
            &nbsp;&nbsp;&nbsp;


            {% call  confirm_call(modal_id) %}
                <i class="glyphicon glyphicon-plus" title="添加"></i>
            {% endcall %}

            <a style="float:right;" href="/flow/">
                <i class="glyphicon glyphicon-th" title="首页"></i>
            </a>
        </div>
        <div class="panel-body">

            {% call  confirm_box(modal_id,"添加用户",modal_endpoint) %}
                <select name='uid' class="form-control">
                    {% for item in users %}
                        <option value="{{ item.uid }}">{{ item.account }}({{ item.name }})</option>
                    {% endfor %}
                </select>
            {% endcall %}
{#            <div class="modal fade" id="Modal{{ node.nid }}" tabindex="-1" role="dialog"#}
{#                 aria-labelledby="myModalLabel" aria-hidden="true">#}
{#                <div class="modal-dialog">#}
{#                    <div class="modal-content">#}
{#                        <form action="/flow/create_node_config/{{ node.nid }}"#}
{#                              method="POST">#}
{#                            <div class="modal-header">#}
{#                                <button type="button" class="close" data-dismiss="modal"#}
{#                                        aria-hidden="true">#}
{#                                    &times;#}
{#                                </button>#}
{#                                <h4 class="modal-title">添加用户</h4>#}
{#                            </div>#}
{#                            <div class="modal-body">#}
{##}
{##}
{#                                <select name='uid' class="form-control">#}
{#                                    {% for item in users %}#}
{#                                        <option value="{{ item.uid }}">{{ item.account }}({{ item.name }})</option>#}
{#                                    {% endfor %}#}
{#                                </select>#}
{##}
{##}
{#                            </div>#}
{#                            <div class="modal-footer">#}
{#                                <button type="button" class="btn btn-default"#}
{#                                        data-dismiss="modal">#}
{#                                    关闭#}
{#                                </button>#}
{#                                <button type="submit" class="btn btn-primary">提交</button>#}
{#                            </div>#}
{#                        </form>#}
{#                    </div>#}
{#                </div>#}
{#            </div>#}

            {% if node.configs %}
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户</th>
                        <th>启用状态</th>
                        <th>创建人</th>
                        <th>创建日期</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for item in node.configs %}
                        <tr>
                            <td>{{ item.id }}</td>
                            <td>{{ item.user.account }}({{ item.user.name }})</td>
                            <td>
                                {% if item.enabled %}
                                    <a href="/flow/update_node_config_enabled/{{ item.id }}">
                                                        <span class="glyphicon glyphicon-ok-circle"
                                                              style="color: blue;font-size: 20px"></span> </a>
                                {% else %}
                                    <a href="/flow/update_node_config_enabled/{{ item.id }}">
                                                        <span class="glyphicon glyphicon-ban-circle"
                                                              style="color: red;font-size: 20px"></span> </a>
                                {% endif %}
                            </td>
                            <td>{% if item.create_uid != None %}{{ item.create_user.name }} {% else %}
                                - {% endif %} </td>
                            <td>{{ item.create_date }}</td>
                            <td style="text-align: center">
                                <a href="/flow/delete_node_config/{{ item.id }}">
                                    <i class="glyphicon glyphicon-remove-circle"
                                       title="删除"></i>
                                </a>
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% else %}
                <div class="jumbotron">


                    <h3>没有配置信息</h3>
                    <p>&nbsp;</p>

                    <p><a class="btn btn-primary btn" href="/car_form/None"
                          data-toggle="modal" data-target="#Modal{{ node.nid }}"
                          role="button">添加</a></p>


                </div>
            {% endif %}

        </div>
    </div>
{% endif %}